package cn.xtits.design.service.impl;
import cn.xtits.design.entity.TemplateData;
import cn.xtits.design.entity.TemplateDataExample;
import cn.xtits.design.mapper.base.TemplateDataMapper;
import cn.xtits.design.service.TemplateDataService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Generator on 2019-10-23 02:00:06
 */
@Service
public class TemplateDataServiceImpl implements TemplateDataService {

    @Resource
    private TemplateDataMapper templateDataMapper;

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return templateDataMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(TemplateData record) {
        return templateDataMapper.insertSelective(record);
    }

    @Override
    public List<TemplateData> listByExample(TemplateDataExample example) {
        PageHelper.startPage(example.getPageIndex().intValue(), example.getPageSize().intValue());
        Page page = (Page) templateDataMapper.selectByExample(example);
        example.setCount((int)page.getTotal());
        return page.toPageInfo().getList();
    }

    @Override
    public TemplateData getByPrimaryKey(Integer id) {
        return templateDataMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKey(TemplateData record) {
        return templateDataMapper.updateByPrimaryKey(record);
    }

    @Override
    public int updateByPrimaryKeySelective(TemplateData record) {
        return templateDataMapper.updateByPrimaryKeySelective(record);
    }



}